From 293d3fe39e67fede4cd8538ab3c3aa92a1ed9c96 Mon Sep 17 00:00:00 2001 From: Srinivas Reddy Thatiparthy Date: Thu, 12 May 2016 22:22:25 +0530 Subject: [PATCH] remove deprecated function sleep_ms and change it to sleep(Duration::from_millis..) --- tests/test_cargo_compile_custom_build.rs | 3 ++- tests/tests.rs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index b88963de4..78320de7d 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -406,10 +406,11 @@ test!(rebuild_continues_to_pass_env_vars { "#) .file("src/lib.rs", "") .file("build.rs", r#" + use std::time::Duration; fn main() { println!("cargo:foo=bar"); println!("cargo:bar=baz"); - std::thread::sleep_ms(500); + std::thread::sleep(Duration::from_millis(500)); } "#); a.build(); diff --git a/tests/tests.rs b/tests/tests.rs index c41cb9b3c..a7142733e 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -20,6 +20,7 @@ extern crate log; use cargo::util::Rustc; use std::ffi::OsStr; +use std::time::Duration; mod support; macro_rules! test { @@ -107,7 +108,6 @@ fn cargo_process() -> cargo::util::ProcessBuilder { process(&support::cargo_dir().join("cargo")) } -#[allow(deprecated)] // sleep_ms is now deprecated in favor of sleep() -fn sleep_ms(ms: u32) { - std::thread::sleep_ms(ms); +fn sleep_ms(ms: u64) { + std::thread::sleep(Duration::from_millis(ms)); } -- 2.30.2